package com.company.action;

import org.apache.struts2.ServletActionContext;

import com.company.dao.PageProDao;
import com.company.entity.Accounts;
import com.company.service.AccountsService;
import com.company.service.PageProService;

public class PagePro3Action extends BaseAction {

	PageProService pageProService;

	public PageProService getPageProService() {
		return pageProService;
	}

	public void setPageProService(PageProService pageProService) {
		this.pageProService = pageProService;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub int
		int pageNum = Integer.valueOf(ServletActionContext.getRequest()
				.getParameter("page"));
		int fenlei = Integer.valueOf(ServletActionContext.getRequest()
				.getParameter("page"));
		int PageMaxnum = pageProService.queryPageNum(3);
		if (pageNum > PageMaxnum) {
			return "success";
		}
		ServletActionContext.getRequest().getSession()
				.setAttribute("PageMaxnum", PageMaxnum);

		ServletActionContext.getRequest().getSession()
				.setAttribute("ProList", pageProService.query(pageNum, 3));
		return super.execute();
	}

}
